(function(window,undefined){
	var Talk = {};
	window.Talk = window.Talk || Talk;
	
	/*side-menu > 인기토크*/
	// $(function(){
		// Talk.loadTalkList();
		// Talk.popularTalkBlock();
		// Talk.writeBlock();
	// });
	
	/*review.php,store_view.php > 토크리스트*/
	Talk.loadTalkList = function(){
		var selector = 'ul.talkList';
		var _user_id = sessionStorage.getItem('user_id');
		var _category_code = sessionStorage.getItem('category_code');
		var _landmark_code = sessionStorage.getItem('landmark_code');
		
		$.ajax({
			type : "post",
			url : ajaxURL + "talk.php?action=loadTalkList",
			dataType : "json",
			data : {user_id:_user_id,category_code:_category_code,landmark_code:_landmark_code,row:Paging.getCurrent()},
			success : function(result) {
				console.log('loadTalkList');
				console.log(result);
				
				$(selector).empty();
				if(result.length == 0){
					
					template.noTalk(selector);
				}
				$.each(result.data,function(key){
					if(this.isUseful){
						this.isUseful = 'off';
					} else{
						this.isUseful = '';
					}
					
					if(this.userImage==null){
						this.userImage='images/default_user.png';
					}
					
					template.talklist(this);
					loadChildComment(this.childComment,this.post_id);
				});
				
				talkListener();
				var _para = {
					dataLength : result.length,
					// dataLength : 11,
					selector : '#pagination > ul',
					callback : function(){
						Talk.loadTalkList();
					}
				};
				Paging.innerAJAX(_para);
			}
		});
	};

	Talk.loadMyTalkList = function(){
		var selector = 'ul.talkList';
		var _user_id = checkUrlId();
		var _landmark_code = sessionStorage.getItem('landmark_code');
		
		$.ajax({
			type : "post",
			url : ajaxURL + "talk.php?action=loadMyTalkList",
			dataType : "json",
			data : {user_id:_user_id,landmark_code:_landmark_code,row:Paging.getCurrent()},
			success : function(result) {
				console.log('loadMyTalkList');
				console.log(result);
				
				$(selector).empty();
				if(result.length == 0){
					
					template.noMyTalk(selector);
				}
				$.each(result.data,function(key){
					if(this.isUseful){
						this.isUseful = 'off';
					} else{
						this.isUseful = '';
					}
					
					if(this.userImage==null || this.userImage==''){
						this.userImage='images/default_user.png';
					}
					
					template.peopletalklist(this);
					loadChildComment(this.childComment,this.post_id);
				});
				
				talkListener();
				var _para = {
					dataLength : result.length,
					// dataLength : 11,
					selector : '#pagination > ul',
					callback : function(){
						Talk.loadMyTalkList();
					}
				};
				Paging.innerAJAX(_para);
			}
		});
	};
	/*store_view*/
	Talk.writeBlock = function(){
		var _user_name = sessionStorage.getItem('user_name');
		var _user_image = sessionStorage.getItem('user_image');
		var _user_id = sessionStorage.getItem('user_id');
		
		var _btnUpload=$('#upload');
		var _store_id = getUrlId();
		var _time = new Date();
		var _fileName = _store_id+"_"+_time.getYear() + "_" + _time.getMonth() + "_" + _time.getDay() + "_" + _time.getDate() + "_" + _time.getHours() + "_" + _time.getMinutes() + "_" + _time.getSeconds();
		var isFile = false;
		var _degree=0;
		
		if(!_user_name){
			_user_name = 'GUEST';
		}
		if(!_user_image || _user_image==null|| _user_image==''){
			_user_image = 'images/default_user.png';
		}
		
		$('.talkWrite > .thumbWrap > img').attr('src',_user_image);
		$('.talkWrite > .thumbWrap > .name').html(_user_name);
		
		/*작성완료*/
		$('.reviewWrite').off('click').on('click',function(event){
			event.preventDefault();
			if(!_user_id){
				alert(NEED_LOGIN_MESSAGE);
				location.href="login.php";
				return;
			}
			if(isFile == true){
				addPost(_fileName);
			}else{
				addPost();
			}
			
			
		});
		
		/*사진추가*/
		// $('#upload').off('click').on('click',function(event){
			// event.preventDefault();
			// if(!_user_id){
				// alert(NEED_LOGIN_MESSAGE);
				// location.href="login.php";
				// return;
			// }
		// });
		
		
		new AjaxUpload(_btnUpload, {
			action: ajaxURL+'image.php?action=imgUpload&degree='+_degree,
			name: 'uploadfile',
			data: {type:"post", fileName:_fileName},
			onSubmit: function(file, ext){
				
				
				if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){ 
                    // extension is not allowed 
					alert('Only JPG, PNG or GIF files are allowed');
					return false;
				}

			},
			onComplete: function(file, response){
				isFile = true;
				
				
			}
		});
	};
	
	Talk.popularTalkBlock = function(){
		var _row=0;
		popularTalkList(_row);
		$('.widgetPagination:nth(1) a:nth(0)').on("click",function(event){
			event.preventDefault();
			_row =0;
			$('.widgetPagination:nth(1) a').removeClass('on');
			$(this).addClass('on');
			popularTalkList(_row);
			
		});
		$('.widgetPagination:nth(1) a:nth(1)').on("click",function(event){
			event.preventDefault();
			_row =4;
			$('.widgetPagination:nth(1) a').removeClass('on');
			$(this).addClass('on');
			popularTalkList(_row);
			
		});
		
		
	};

	var popularTalkList = function(_row){
		var _selector='.talkListWidget';
		
		$.ajax({
			type:"post",
			url:ajaxURL+'talk.php?action=popularTalkList',
			data:{row:_row},
			dataType:"json",
			success:function(result){
				console.log('popularTalkBlock');
				console.log(result);
				$(_selector).empty();
				if(result.length == 0){
					template.noSideTalk(_selector);
					$('.widgetNoneWrap').css("border","none");
					//$('.unitWrap.styleA li').css('padding','0');
				}
				if(result.length<=4){
					$('ul.widgetPagination:nth(1)').remove(); 
				}
				
				$.each(result,function(key){
					if(this.userImage==null){
						this.userImage='images/default_user.png';
					}
					template.popularTalkList(this,key);
				});
			}
		});
	};
	
	
	/*store_view.php > 토크리스트*/
	Talk.loadStoreTalkList = function(){
		var _user_id = sessionStorage.getItem('user_id');
		var _store_id = getUrlId();
		$.ajax({
			type : "post",
			url : ajaxURL + "talk.php?action=loadStoreTalkList",
			dataType : "json",
			data : {store_id : _store_id,user_id:_user_id},
			success : function(result) {
				console.log('loadStoreTalkList');
				console.log(result);
				
				$('.headCount.small .orange').html(result.length);
				$('ul.talkList').empty();
				$.each(result.data,function(key){
					if(this.isUseful){
						this.isUseful = 'off';
					} else{
						this.isUseful = '';
					}
					
					if(this.userActivityPoint==false){
						this.userActivityPoint=0;
					}
					
					if(this.userImage==null){
						this.userImage='images/default_user.png';
					}
					template.storeTalklist(this);
					loadChildComment(this.childComment,this.post_id);
				});
				
				talkListener();
				var _para = {
					dataLength : result.length,
					// dataLength : 11,
					selector : '#pagination > ul',
					callback : function(){
						Talk.loadStoreTalkList();
					}
				};
				Paging.innerAJAX(_para);
			}
		});
	};
	

	
	var talkListener=function(){
		/*유용해요 버튼*/
		
		var _user_id = sessionStorage.getItem('user_id');
		$('.usefulBtn').off('click').on('click', function(event) {
			event.preventDefault();

			if (!_user_id) {
				alert(NEED_LOGIN_MESSAGE);
				location.href = "login.php";
				return;
			}

			$(this).toggleClass('off');

			var _useful = $(this).parent().children('b').html();
			var _post_id = $(this).data('post_id');

			if ($(this).hasClass('off')) {
				addUsefulPost(_post_id);
				_useful = parseInt(_useful) + 1;
			} else {
				delUsefulPost(_post_id);
				_useful = parseInt(_useful) - 1;
			}

			$(this).parent().children('b').html(_useful);
		});

		/*댓글*/
		$('.comments a').toggle(function(event) {
			event.preventDefault();
			$(this).parents().children('.replyWrap').fadeIn();
		}, function(event) {
			event.preventDefault();
			$(this).parents().children('.replyWrap').hide();
		});

		/*댓글쓰기*/
		$('.replyWrite img').off('click').on('click', function(event) {

			event.preventDefault();
			if (!_user_id) {
				alert(NEED_LOGIN_MESSAGE);
				location.href = "login.php";
				return;
			}
			var _parent_post_id = $(this).data('post_id');
			var _message = $(this).parents().children('input').val();
			var _store_id = $(this).parents().find('.comments').data('store_id');

			insertComment(_store_id, _parent_post_id, _message);
		});

		/*글 삭제*/
		$('.delete').off('click').on('click', function(event) {

			event.preventDefault();
			var _post_id = $(this).data('post_id');
			delPost($(this), _post_id);
		});
	};
	/*store_view.php > 글쓰기*/
	var addPost = function(_fileName){
		if(!_fileName){
			_fileName=null;
		}
		var _user_id = sessionStorage.getItem('user_id');
		var _store_id = getUrlId();
		var _message = $('textarea').val();
		var _is_recommend;
		if($('.writeWrap input[type="checkbox"]').is(":checked")){
			_is_recommend = TRUE;
		}else{
			_is_recommend = false;
		}
		
		$.ajax({
			type:"post",
			url:ajaxURL + "talk.php?action=addPost",
			dataType:'json',
			data:{user_id : _user_id, store_id : _store_id, message : _message, is_recommend : _is_recommend, fileName:_fileName},
			success:function(result){
				console.log('addPost');
				if(result.image!=null){
					Sns.msgPhotoShareToFacebook(result);	
				}else{
					Sns.msgShareToFacebook(result);
				}
			},
		});
	};
	var addUsefulPost = function(__post_id){
		var _user_id = sessionStorage.getItem('user_id');
		
		$.ajax({
			type:"post",
			url:ajaxURL + "useful.php?action=addUsefulPost",
			data:{user_id:_user_id,post_id:__post_id},
			success:function(result){
				 console.log(result);
			}
		});
	};
	
	var delUsefulPost = function(__post_id){
		var _user_id = sessionStorage.getItem('user_id');
		
		$.ajax({
			type:"post",
			url:ajaxURL + "useful.php?action=delUsefulPost",
			data:{user_id:_user_id,post_id:__post_id},
			success:function(result){
				console.log(result);
			}
		});
	};
	
	var loadChildComment = function(result,post_id) {
		var _user_id=sessionStorage.getItem('user_id');
				
		var delBtn,info = '';
		
		$.each(result,function(key2){
			if(key2==0){
				key2='';
			}else{
				key2='<div class="clear"></div>';
			}
			if(_user_id==this.created_user_id){
				delBtn=' | <a data-post_id="'+this.post_id+'" id="delComment">삭제</a>';
			}else{
				delBtn='';
			}
			if(this.is_owner==true){
				info += key2+'<div class="reply right">'+this.message+'<b>'+this.store_name+'</b><div><span class="time">'+this.created_date+delBtn+'</span></div><div>';
			}else{
				info += key2+'<div class="reply left"><b>'+this.user_name+' - </b>'+this.message+'<span class="time">'+this.created_date+delBtn+'</span></div>';	
			}
		});
		
		$('.replyList[data-post_id='+post_id+']').html(info);
		
		/*댓글삭제*/
		$('.time a').off('click').on("click",function(event){
			event.preventDefault();
			var _post_id = $(this).data('post_id');
			delComment($(this),_post_id,post_id);
					
		});

	};
	
	function delComment(that,_post_id,_parent_post_id){
		$.ajax({
			type:"post",
			url:ajaxURL + "talk.php?action=delComment",
			data:{post_id:_post_id,parent_post_id:_parent_post_id},
			dataType:'json',
			success:function(result){
				console.log(result);
				//loadChildComment(result,_post_id);
				that.parents('.reply').fadeOut();
				$('a[data-post_id='+_parent_post_id+']').html('댓글('+result.length+') ');
				//$('#showComment').html('댓글('+result.length+') ');
			}
		});
	}
	
	
	function delPost(that,_post_id){
		$.ajax({
			type:"post",
			url:ajaxURL + "talk.php?action=delPost",
			data:{post_id:_post_id},
			dataType:'json',
			success:function(result){
				console.log(result);
				that.parents('li').fadeOut();
			}
		});
	}
	
	function insertComment(_store_id,_parent_post_id,_message){
		var _user_id=sessionStorage.getItem('user_id');
		
		$.ajax({
			type:"post",
			url:ajaxURL + "talk.php?action=insertComment",
			data:{store_id:_store_id,parent_post_id:_parent_post_id,user_id:_user_id,message:_message},
			dataType:'json',
			success:function(result){
				loadChildComment(result.childComment,_parent_post_id);
				$('.replyWrite input').val('');
				$('a[data-post_id='+_parent_post_id+']').html('댓글('+result.length+') ');
			}
		});
	}
	
	var template = {
		noTalk : function(selector){
			var category_name;
			($('.depth2 .menu .on a').html()=='전체')?category_name=$('.depth1 .menu .on a').html():category_name=$('.depth2 .menu .on a').html().substring(0,$('.depth2 .menu .on a').html().length-3);
		
			var info = '';
			info += '<div class="noneListWrap">';
			info += '<div class="titleArea"><img src="images/nolist_talk.png" alt=""  />';
			info += '<h4><span>'+sessionStorage.getItem('landmark_name')+'</span>지역의 <span>'+category_name+'</span>카테고리에는 아직 토크가 없습니다.</h4>';
			info += '</div>';
			info += '</div>';	
			
			$(selector).append(info);
		},
		noMyTalk : function(selector){
			var info = '';
			info += '<div class="noneListWrap">';
			info += '<div class="titleArea"><img src="images/nolist_talk.png" alt=""  />';
			info += '<h4>구피 토크가 없습니다.';
			if(checkUrlId()==sessionStorage.getItem('user_id')){
				info += '<br/>토크를 작성하거나 구피 친구를 추가해보세요.';
			}
			info += '</h4></div>';
			if(checkUrlId()==sessionStorage.getItem('user_id')){
				info += '<div class="subArea">';
				info += '<p>다른 사람들의 토크가 궁금하세요? 토크 메뉴에서 확인해보세요.<br/><br/>'
				info += '<a href="people.php"><img src="images/btn_link.png" alt="바로가기" /></a></p>';
				info += '</div>';	
			}
			info += '</div>';	
			
			$(selector).append(info);
		},
		
		noSideTalk : function(selector){
			var info = '';
			// info += '<h3><img src="images/titles/popular_coupon.png" alt="인기쿠폰"/></h3>';
			// info += '<div class="clear"></div>';
			info += '<li class="first-child">';
			info += '<div class="widgetNoneWrap">';
			info += '<img src="images/nolist_talk_s.png" alt="nolist_coupon_s"   />';
			info += '<span>토크가 없습니다.</span>';
			info += '</div>';
			info += '</li>';	
			
			$(selector).append(info);
		},
		talklist : function(result){ 
			var _user_id = sessionStorage.getItem('user_id');     
			var info='';
			info += '<li>';
			info += '<div class="thumbWrap">';
			info += '<a href="people_view.php?id='+result.created_user_id+'">';
			info +=	'<img width="60px" height="60px" src="' + result.userImage + '" alt="thumb_store_1">';
			info +=	'</a>';    
			info +=	'</div>';
			if(result.is_recommend==true){
				info += '<div class="judgeWrap"><img src="images/judge_up.png" alt="만족"></div>';
			}
			info +=	'<div class="infoWrap">';
			info +=	'<a class="name" href="people_view.php?id='+result.created_user_id+'">'+result.userName+'</a>';
			info +=	'<a class="title" href="store_view.php?id='+result.store_id+'"><b>'+result.name+'</b>에 대한 토크</a>';
			info += '<div class="storeInfo left">만족도 <b>'+result.satisfaction+'%</b> 단골수 <b>'+result.favorite_count+'</b>명</div>';
			info += '<div class="tags left">'+result.category_name+' <span>|</span> '+result.addr2+'</div>';             
			/* 
			info += '<a class="title store-page-linker" data-store_id='+result.store_id+' href="store_view.php"><b>'+result.storeName+'</b>에 대한 토크</a>';		
			info +=	'<div class="storeInfo left">활동지수 <b>'+result.userActivityPoint+'</b> &nbsp;&nbsp;&nbsp; 친구 <b>'+result.friendCount+'</b>명</div>';*/
			info +=	'<div class="date">'+result.created_date;
			if(_user_id==result.created_user_id){
				info += '<span> | </span><a class="delete" href="#" data-post_id='+result.post_id+'>토크삭제<img src="images/talk_delete.png" alt="" ></a>';
			}
			info +='</div>';
			info += '</div>';
			info +=	'<div class="clear"></div>';
			info +=	'<div class="commentWrap">';
			if(result.image!=null){
				info += '<a class="imgWrap" href="#"><img src="'+result.image+'" alt="store_gallery_img"></a>';
			}
			info +=	'<p>'+result.message+'</p>';
			info +=	'<div class="clear"></div>';
			info +=	'</div>';   
			info += '<div class="footWrap">';
			info += '<div class="usefulWrap"><a href="#" class="usefulBtn '+result.isUseful+'" data-post_id='+result.post_id+'>유용해요</a> - <b>'+result.usefulPostCount+'</b>명이 유용하다고 평가</span></div>';
			info += '<div data-store_id='+result.store_id+' class="comments"><a data-post_id='+result.post_id+' href="#">댓글('+result.commentCount+') </a></div>';
			info += '<div class="clear"></div></div>';
			info += '<div style="display:none;" class="replyWrap">';
			info += '<div data-post_id='+result.post_id+' class="replyList">';
			info += '</div>';
			info += '<a><div class="clear"></div>';
			info += '<div class="replyWrite" ><input class="textInput" placeholder="댓글을 입력해주세요."> <img data-post_id='+result.post_id+' src="images/btn_comment.png" alt="btn_comment">';
			info += '</div></a>';
			info += '</div>';
			info += '</li>';
			
			$('ul.talkList').append(info);
		},
		peopletalklist : function(result){       
			var info='';
			info += '<li>';
			if(result.parent_post_id==0){
				info += '<div class="type talk"></div>';
				info += '<div class="thumbWrap">';
				info += '<a href="people_view.php?id='+result.created_user_id+'">';
				info +=	'<img width="60px" height="60px" src="' + result.userImage + '" alt="thumb_store_1">';
				info +=	'</a>';    
				info +=	'</div>';
				if(result.is_recommend==true){
					info += '<div class="judgeWrap"><img src="images/judge_up.png" alt="만족"></div>';
				}
				info +=	'<div class="infoWrap">';
				info +=	'<a class="name" href="people_view.php?id='+result.created_user_id+'">'+result.userName+'</a>';
				info +=	'<a class="title" href="store_view.php?id='+result.store_id+'"><b>'+result.name+'</b>에 대한 토크</a>';
				info += '<div class="storeInfo left">만족도 <b>'+result.satisfaction+'%</b> 단골수 <b>'+result.favorite_count+'</b>명</div>';
				info += '<div class="tags left">'+result.category_name+' <span>|</span> '+result.addr2+'</div>';             
				info +=	'<div class="date">'+result.created_date;
				if(checkUrlId()==sessionStorage.getItem('user_id')){
					info += '<span> | </span>';
					info += '<a class="delete"  href="#" data-post_id='+result.post_id+' >토크삭제<img src="images/talk_delete.png" alt="" ></a>';
				}
				info +='</div>';
				info += '</div>';
				info +=	'<div class="clear"></div>';
				info +=	'<div class="commentWrap">';
				info +=	'<p>'+result.message+'</p>';
				info +=	'</div>';   
				info += '<div class="footWrap">';
				info += '<div class="usefulWrap"><a href="#" class="usefulBtn '+result.isUseful+'" data-post_id='+result.post_id+'>유용해요</a> - <b>'+result.usefulPostCount+'</b>명이 유용하다고 평가</span></div>';
				info += '<div data-store_id='+result.store_id+' class="comments"><a data-post_id='+result.post_id+' href="#">댓글('+result.commentCount+') </a></div>';
				info += '<div class="clear"></div></div>';
				info += '<div style="display:none;" class="replyWrap">';
				info += '<div data-post_id='+result.post_id+' class="replyList">';
				info += '</div>';
				info += '<a><div class="clear"></div>';
				info += '<div class="replyWrite" ><input class="textInput" placeholder="댓글을 입력해주세요."> <img data-post_id='+result.post_id+' src="images/btn_comment.png" alt="btn_comment">';
				info += '</div></a>';
				info += '</div>';
			
			}else{
				info += '<div class="type comment"></div>';
				info += '<div class="thumbWrap small">';
				info += '<a href="store_view.php?id='+result.store_id+'">';
				info +=	'<img width="50px" height="50px" src="' + result.parent_user_image + '" alt="thumb_store_1">';
				info +=	'</a>';    
				info +=	'</div>';
				info +=	'<div class="infoWrap">';
				info +=	'<a class="name" href="people_view.php?id='+result.created_user_id+'">'+result.userName+'</a>';
				info +=	'<a class="title" href="store_view.php?id='+result.store_id+'"><b>'+result.parent_user_name+'</b>의 토크에 남긴 댓글</a>';
				info +=	'<div class="date">'+result.created_date;
				if(checkUrlId()==sessionStorage.getItem('user_id')){
					info += '<span> | </span>';
					info += '<a class="delete"  href="#" data-post_id='+result.post_id+' >댓글삭제<img src="images/talk_delete.png" alt="" ></a>';
				}
				info +='</div>';
				info += '<div class="clear"></div>';
				info += '<div class="commentWrap"><p>'+result.message+'</p></div>';
				
			}
			info += '</li>';
			$('ul.talkList').append(info);
		},
		storeTalklist : function(result){
			var _user_id = sessionStorage.getItem('user_id');   	         
			var info='';
			info += '<li>';
			info += '<div class="thumbWrap">';
			info += '<a href="people_view.php?id='+result.created_user_id+'">';
			info +=	'<img width="60px" height="60px" src="' + result.userImage + '" alt="thumb_store_1" >';
			info +=	'</a>';    
			info +=	'</div>';
			if(result.is_recommend==true){
				info += '<div class="judgeWrap"><img src="images/judge_up.png" alt="만족"></div>';
			}
			info +=	'<div class="infoWrap">';
			info +=	'<a class="title" href="people_view.php?id='+result.created_user_id+'">'+result.userName+'</a>';
			info += '<div class="storeInfo left">활동지수 <b>'+result.userActivityPoint+'</b> &nbsp;&nbsp;&nbsp; 친구 <b>'+result.friendCount+'</b>명<br/>랭킹 <b>3</b>개  &nbsp;&nbsp;&nbsp; 토크 <b>'+result.talkCount+'</b>개 </div>';
			info +=	'<div class="date">'+result.created_date;
			if(_user_id==result.created_user_id){
				info += '<span> | </span><a class="delete"  href="#" data-post_id='+result.post_id+' >토크삭제<img src="images/talk_delete.png" alt="" ></a>';
			}
			info +='</div>';
			info += '</div>';
			info +=	'<div class="clear"></div>';
			info +=	'<div class="commentWrap">';
			if(result.image!=null){
				info += '<a class="imgWrap" href="#"><img src="'+result.image+'" alt="store_gallery_img"></a>';
			}
			info +=	'<p>'+result.message+'</p>';
			info +=	'<div class="clear"></div>';
			info +=	'</div>';    
			info += '<div class="footWrap">';
			info += '<div class="usefulWrap"><a href="#" class="usefulBtn '+result.isUseful+'" data-post_id='+result.post_id+'>유용해요</a> - <b>'+result.usefulPostCount+'</b>명이 유용하다고 평가</span></div>';
			info += '<div data-store_id='+result.store_id+' class="comments"><a data-post_id='+result.post_id+' id="showComment" href="#">댓글('+result.commentCount+') </a></div>';
			info += '<div class="clear"></div></div>';
			info += '<div style="display:none;" class="replyWrap">';
			info += '<div data-post_id='+result.post_id+' class="replyList">';
			info += '</div>';
			info += '<a><div class="clear"></div>';
			info += '<div class="replyWrite" ><input class="textInput" placeholder="댓글을 입력해주세요."> <img data-post_id='+result.post_id+' src="images/btn_comment.png" alt="btn_comment">';
			info += '</div></a>';
			info += '</div>';
			info += '</li>';
			
			$('ul.talkList').append(info);
		},
		popularTalkList : function(result,key){
			var info = '';
			if(key==0){
				info += '<li class="first-child">';
			}else{
				info += '<li>';
			}
			info += '<div class="thumbWrap">';
			info += '<a href="people_view.php?id='+result.created_user_id+'">';
			info += '<img width="60px" height="60px" src="'+result.userImage+'" alt="">';
			info += '</a>';
			info += '</div>';
			info += '<div class="infoWrap">';
			info += '<div class="names">';
			info += '<a href="#">'+result.userName+'</a>';
			info += '</div>';
			info += '<a class="title" href="store_view.php?id='+result.store_id+'"><span>'+result.storeName+'</span>에 대한 토크</a>';
			info += '<div class="recommend">';
			info += '<span>추천 <b>'+result.usefulCount+'</b>명</span>';
			info += '</div>';
			info += '</div>';
			info += '<div class="clear"></div>';
			info += '<div class="commentWrap">';
			info += '<a href="#">'+result.message+'</a>';
			info += '</div>';
			info += '</li>';
			
			$('.talkListWidget').append(info);
		}
	}
})(window);
